package com.pqmvc{
	import flash.events.EventDispatcher;
	public class PQEventDispatcher extends EventDispatcher{
		static private var eventList:Object={};
		public function PQEventDispatcher()
		{
		}	
		/**注册监听事件*/
		public function addListen(str:String, func:Function):void{
			this.addEventListener(str, function(e:PQEvent):void{
				eventList[{type:e.type,callback:func}]=arguments.callee;
				e.data.unshift(e.type);
				func.apply(null,e.data);
				e.data.shift();
			});
		}
		/**发送事件 */
		public function call(str:String, ...args):void{
			this.dispatchEvent(new PQEvent(str, args));
		}
		/**移除监听**/
		public function removeListen(event:String,func:Function):void{
			if(!eventList[{type:event,callback:func}])return;
			this.removeEventListener(event,eventList[{type:event,callback:func}] as Function);
		}
	}
}